package com.gxlevi.flyweight;

public class Client {
    public static void main(String[] args) {
        WebSiteFactory factory = new WebSiteFactory();
        WebSite webSite1 = factory.getWebSiteCategory("新闻");
        webSite1.use(new User("小明"));

        WebSite webSite2 = factory.getWebSiteCategory("新闻");
        webSite2.use(new User("小红"));

        WebSite webSite3 = factory.getWebSiteCategory("博客");
        webSite3.use(new User("老王"));

        System.out.println(webSite1.hashCode());
        System.out.println(webSite2.hashCode());
        System.out.println(webSite3.hashCode());

        System.out.println("网站的分类共="+factory.getWebSiteCount());
    }
}
